
local network = cc.import("#network")
local NetMsgConstants = network.NetMsgConstants
local NetMsg = network.NetMsg

local gbc = cc.import("#gbc")
local ChatAction = cc.class("ChatAction", gbc.ActionBase)

ChatAction.ACCEPTED_REQUEST_TYPE = "websocket"

function ChatAction:sendchatAction(args)
    
    cc.printerror("chat Action")
    cc.printerror(args)
    local msg = NetMsg.parser(args)

    cc.printerror(msg:getAction())
    cc.printerror(msg:getError())
    msg:setAction("chat.newChat")

    local instance = self:getInstance()
    local broadcast = gbc.Broadcast:new(instance:getRedis(), instance.config.app.websocketMessageFormat)

    broadcast:sendMessageToAll(msg:getData())

    return

end


return ChatAction
